<?php defined('BASE_PATH') or die('No direct script access.');
class Registry {
       /**
     * Static instance
     *
     * @var SingletonRegistry
     */
    private static $_instance;

    /**
     * Object hash map
     *
     * @var array
     */
    protected $_map;
    /**
     * Private constructor
     * Get the single instance
     *
     * @return SingletonRegistry
     */
    public static function getInstance() {
        if(self::$_instance === null) {
            //First and only construction.
            self::$_instance = new self();
        }
        return self::$_instance;
    }

    /**
     * Get an object by key
     *
     * @param string|int $key
     * @return object
     */
    public function get($key) {
        return $this->_map[$key];
    }

    /**
     * Set an object by key
     *
     * @param string|int $key
     */
    public function set($key, $object) {
        return $this->_map[$key] = $object;
    }

    /**
     * Disallow cloning
     *
     */
    private function __clone() {
    }
}
?>